package utils

import "encoding/json"

func JsonStrToStrcut(jsonStr string, target interface{}) error {
	return JsonBytesToStrcut([]byte(jsonStr), target)
}

func JsonBytesToStrcut(jsonBts []byte, target interface{}) error {
	return json.Unmarshal(jsonBts, target)
}
func StructToJson(target interface{}) (string, error) {
	s, e := json.Marshal(target)
	if e != nil {
		return "", e
	}
	return string(s), nil
}
